/*
 * @Description: 
 * @Author: changqing
 * @Date: 2021-08-29 22:19:54
 * @LastEditTime: 2021-08-29 22:22:08
 * @LastEditors: changqing
 * @Usage: 
 */
var { forkJoin,of,timer, interval } = require('rxjs');
var { map,take} = require('rxjs/operators');

const sourceA = interval(1000).pipe(
  map((data) => `A${++data}`),
  take(5)
);
const sourceB = interval(2000).pipe(
  map((data) => `B${++data}`),
  take(4)
);
const sourceC = interval(3000).pipe(
  map((data) => `C${++data}`),
  take(3)
);

forkJoin([sourceA, sourceB, sourceC]).subscribe({
  next: (data) => console.log(`forkJoin 示例: ${data}`),
  complete: () => console.log("forkJoin 结束"),
});
//forkJoin 示例: A5,B4,C3
// forkJoin 结束